// Tabs = 4
//************************************************************
//	COPYRIGHT 2011 Bread Zeppelin - ALL RIGHTS RESERVED
//
// This file is the product of Bread Zeppelin and cannot be 
// reproduced, copied, or used in any shape or form without 
// the express written consent of Bread Zeppelin.
//************************************************************
//
//	$ID: Concurrent_Assg6
//
//	$Date: Feb 13, 2012
//
//	Reason:
//
//*************************************************************

/** $Author: Ben Hare, Zach Huenink, Philipp Wittmaack, Peter Maresca */
/** $Revision: 1 */

// Default Package

/**
 * A customer party which is entered into the restaurant
 */
public class CustomerParty {

	final private String name;
	final private int size;
	private Table customerTable;
	private Order partyOrder;
	
	

	/**
	 * The constructor for a Customer party which takes name and size
	 * 
	 * @param name - the name of the customerParty
	 * @param size - the number of people in the customerParty
	 */
	CustomerParty(String name, int size){
		this.name = name;
		this.size = size;
	}
	
	/**
	 * Associates the given table with the customerParty
	 * 
	 * @param t - the table given to the customer party
	 */
	public void occupyTable(Table t){	
		customerTable = t;
		t.setOccupied(true);
	}
	
	/**
	 * Picks a new order from the Restaurant.Menu and returns it. 
	 * 
	 * @return order - the customerParty's order
	 */
	public Order createOrder(){
		String menuItem = Restaurant.getInstance().getMenu().readMenu().get(0);
		partyOrder = new Order(this, menuItem);
		
		return partyOrder;
	}
	
	/**
	 * Returns the name of the party
	 * 
	 * @return name - the party name
	 */
	public String getName() {
		return name;
	}
	
	/**
	 * Returns the number of people in the customerParty
	 * 
	 * @return size - the size of the party
	 */
	public int getPartySize() {
		return size;
	}

	public Table getCustomerTable() {
		return customerTable;
	}
	
	public void walkIn() {
		// Initiate CustomerTime Metric
		RestaurantMetrics.getInstance().beginCustomerTime(this, System.currentTimeMillis());
	}
	public void walkOut() {
		// Finalize CustomerTime Metric
		RestaurantMetrics.getInstance().finishCustomerTime(this, System.currentTimeMillis());
	}
	
	public void rageQuit() {
		RestaurantMetrics.getInstance().removeDataMetric(this);
	}

	
}
